﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.SimulationRecorderAndPlayer.SimulationRecorderAndPlayerCmd
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System.ComponentModel;
using System.Windows;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.Ui;


namespace DnProcessSimulateCommands.SimulationRecorderAndPlayer;

internal class SimulationRecorderAndPlayerCmd : TxButtonCommand
{
  protected SimulationRecorderAndPlayerEnabler m_enabler;
  private SimulationRecorderAndPlayerWindow _simulationRecorderAndPlayerWindow;

  public SimulationRecorderAndPlayerCmd()
  {
    this.m_enabler = new SimulationRecorderAndPlayerEnabler();
  }

  public virtual string Category => SimulationRecorderAndPlayerStringTable.CMD_CATEGORY;

  public virtual string Name => SimulationRecorderAndPlayerStringTable.CMD_NAME;

  public virtual string Tooltip => SimulationRecorderAndPlayerStringTable.CMD_TOOLTIP;

  public virtual string Bitmap
  {
    get => "SimulationRecorderAndPlayer.Resources.SimulationRecorderAndPlayer_16px.bmp";
  }

  public virtual string MediumBitmap
  {
    get => "SimulationRecorderAndPlayer.Resources.SimulationRecorderAndPlayer_24px.png";
  }

  public virtual string LargeBitmap
  {
    get => "SimulationRecorderAndPlayer.Resources.SimulationRecorderAndPlayer_32px.png";
  }

  public virtual string Description => SimulationRecorderAndPlayerStringTable.CMD_DESCRIPTION;

  public virtual ITxCommandEnabler CommandEnabler => (ITxCommandEnabler) this.m_enabler;

  public virtual bool Licensed => true;

  public virtual ITxImage Image => (ITxImage) TxImageManager.GetImageByKey("SimulationRecorder");

  public virtual void Execute(object cmdParams)
  {
    this.m_enabler.isOpeded = true;
    if (this._simulationRecorderAndPlayerWindow != null)
    {
      ((Window) this._simulationRecorderAndPlayerWindow).Closing -= new CancelEventHandler(this._simulationRecorderAndPlayerWindow_Closing);
      ((Window) this._simulationRecorderAndPlayerWindow).Close();
    }
    this._simulationRecorderAndPlayerWindow = new SimulationRecorderAndPlayerWindow();
    ((Window) this._simulationRecorderAndPlayerWindow).Closing += new CancelEventHandler(this._simulationRecorderAndPlayerWindow_Closing);
    ((Window) this._simulationRecorderAndPlayerWindow).Show();
  }

  private void _simulationRecorderAndPlayerWindow_Closing(object sender, CancelEventArgs e)
  {
    this.m_enabler.isOpeded = false;
  }
}
